home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 10418 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: castle.nando.net!news
  2. From: actuary@nando.net   (Bill McCarthy)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: square root
  5. Date: 17 Mar 1996 18:45:06 GMT
  6. Organization: Nando.net Public Access
  7. Message-ID: <4ihmji$4ca@castle.nando.net>
  8. References: <84210-826932839@mindlink.bc.ca>
  9. Reply-To: actuary@nando.net (Bill McCarthy)
  10. NNTP-Posting-Host: grail2113.nando.net
  11. X-Newsreader: IBM NewsReader/2 v1.2
  12.  
  13. In <84210-826932839@mindlink.bc.ca>, Kandiah_Ratnavale@mindlink.bc.ca (Kandiah Ratnavale) writes:
  14. >I am trying to learn C
  15. >
  16. >When I try to write a program to calculate a square root, I have included
  17. >stdio.h and math.h and I get an error message saying
  18. >
  19. >"Undefined symbol _sqrt referenced from text segment"
  20. >
  21. >and my program does not compile!
  22. >
  23. >Can anyone clarify the problem and give me some lead as to what I am doing
  24. >wrong?
  25. >
  26. >I am using the Linux OS in X Windows.
  27.  
  28. Are you sure it's a compiler error?  Does it compile OK with the -c flag (for
  29. compiile only)?  If it does, then you are seeing a link error.  There is a bug
  30. or feature (which didn't make it to the OS/2 port) which requires explicit
  31. inclusion of the math library.  I think this is done by appending a -lm flag
  32. to the command line invoking the compile/link.
  33.  
  34. Bill McCarthy
  35. actuary@nando.net
  36. Wendell, NC  USA
  37.  
  38.